package com.jade.bss.base.utils;

import com.jade.bss.base.customer.Customer;
import org.apache.shiro.SecurityUtils;
import java.util.Date;
/**
 * Created with IntelliJ IDEA.
 * User: jinya
 * Date: 2017/6/15
 * Time: 23:45
 * TEL :17701640710   MAIL:2009_jinya@163.com
 * To change this template use File | Settings | File Templates.
 */
public class EntityVo {
    private long id;
    private String ownerId;
    private long creatorId;
    private String creator;
    private Date createTime = new Date();
    private String modifier;
    private Date modifyTime;
    private Customer customer;
    public  EntityVo(){
        Object object= SecurityUtils.getSubject().getPrincipal();
        if(object instanceof  Customer) {
            this.customer=(Customer) object;
            this.ownerId=customer.getOwnerId();
            this.creator=customer.getTrueName();
            this.creatorId=customer.getId();
        }
    }
    public void updateRecord(){
        if(this.customer!=null){
            this.modifier=this.customer.getTrueName();
        }
    }
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(String ownerId) {
        this.ownerId = ownerId;
    }

    public long getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(long creatorId) {
        this.creatorId = creatorId;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getModifier() {
        return modifier;
    }

    public void setModifier(String modifier) {
        this.modifier = modifier;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }
}
